package com.tpay.server.domain;

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="MA_COGRP")
public class Cgroup {
	@Id
	@GeneratedValue
	@Column(name="CG_ID")
	private Integer id;
	
	@Column(name="CG_NM", length=40, nullable=false)
	private String name;
	
	@Temporal(TemporalType.DATE)
	@Column(name="DT_START", nullable=false)
	private Calendar startDate = Calendar.getInstance();
	
	@Temporal(TemporalType.DATE)
	@Column(name="DT_END", nullable=false)
	private Calendar endDate = new GregorianCalendar(2099, 11, 31);
	
	@OneToMany(mappedBy="cgroup")
	@OrderBy("id ASC")
	private Set<Company> companies;

	@OneToMany(mappedBy="cgroup")
	private Set<CgroupApp> cgroupApps;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Calendar getStartDate() {
		return startDate;
	}

	public void setStartDate(Calendar startDate) {
		this.startDate = startDate;
	}

	public Calendar getEndDate() {
		return endDate;
	}

	public void setEndDate(Calendar endDate) {
		this.endDate = endDate;
	}

	public Set<Company> getCompanies() {
		return companies;
	}

	public void setCompanies(Set<Company> companies) {
		this.companies = companies;
	}

	public Set<CgroupApp> getCgroupApps() {
		return cgroupApps;
	}

	public void setCgroupApps(Set<CgroupApp> cgroupApps) {
		this.cgroupApps = cgroupApps;
	}
	
}
